"""
FileName：helper.py
Description：
Author：gaojiahui
Time：2025/8/29 18:39
Website：https://gitee.com/gao-jiahui
"""
import string
import random
import time


def generate_random_username():
    username = ''.join(random.choice(string.ascii_lowercase) for _ in range(8))
    return username

def generate_random_password(length=10):
    password = ''.join(random.choice(string.ascii_letters + string.digits + string.punctuation) for _ in range(length))
    return password

def take_screenshot(driver, test_name):
    timestamp = time.strftime("%Y%m%d-%H%M%S")
    filename = f"screenshots/{test_name}_{timestamp}.png"
    driver.save_screenshot(filename)
    return filename
